package com.fit.entities.manytomany;

import javax.persistence.AssociationOverride;
import javax.persistence.AssociationOverrides;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.Table;

@Entity
@Table(name="User_Degree")
@AssociationOverrides({
	@AssociationOverride(name = "pk.user", joinColumns = @JoinColumn(name = "user_id")),
	@AssociationOverride(name = "pk.degree", joinColumns = @JoinColumn(name = "degree_id")) })
public class UserDegree {

	@EmbeddedId
	private UserDegreePk pk = new UserDegreePk();
	@Column(name="area", nullable=false)
	private String area;
	@Column(name="issuer", nullable=false)
	private String issuer;
	public UserDegreePk getPk() {
		return pk;
	}
	public void setPk(UserDegreePk pk) {
		this.pk = pk;
	}
	public String getArea() {
		return area;
	}
	public void setArea(String area) {
		this.area = area;
	}
	public String getIssuer() {
		return issuer;
	}
	public void setIssuer(String issuer) {
		this.issuer = issuer;
	}
	
	
	public boolean equals(Object o) {
		if (this == o)
			return true;
		if (o == null || getClass() != o.getClass())
			return false;

		UserDegree that = (UserDegree) o;

		if (getPk() != null ? !getPk().equals(that.getPk())
				: that.getPk() != null)
			return false;

		return true;
	}
}
